<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="public/theme/backend/style/vds.css" />
<link rel="stylesheet" type="text/css" href="public/theme/backend/style/main.css" />
<script type="text/javascript" src="public/theme/backend/js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="public/theme/backend/js/vds.js"></script>
<script type="text/javascript">
function submitForm(){
  $('#cate_name').vdsChecker({required:true, maxlength:60});
  $('#seq').vdsChecker({seq:true}, {seq:'无效的排序！只能填写 0 到 99 的整数！'}, {seq: /^([1-9]\d|\d)$/.test($('#seq').val())});
  $('form').vdsSubmit();
}
</script>
</head>
<body>
<{if $_GET['a'] == 'add'}>
<div class="content">
  <div class="loc"><h2><i class="icon"></i>添加新商品分类</h2></div>
  <form method="post" action="<{url m=$MOD c='goods_cate' a='add' step='submit'}>">
    <div class="box">
      <div class="module">
        <table class="dataform">
          <tr>
            <th width="110">分类名称</th>
            <td><input title="分类名称" class="w200 txt" name="cate_name" id="cate_name" type="text" /></td>
          </tr>
          <tr>
            <th>上级分类</th>
            <td>
              <select title="上级分类" id="parent_id" name="parent_id" class="slt">
                <option value="0">-- 无上级分类 --</option>
                <{foreach $parent_select as $v}>
                <option value="<{$v.cate_id}>"><{str_repeat('|— ',$v.lv)}> <{$v.cate_name}></option>
                <{/foreach}>
              </select>
            </td>
          </tr>
          <tr>
            <th>分类下品牌</th>
            <td>
	      <div class="ckrow pad5">
                <ul class="c666">
                <{foreach $brand_select as $v}>
                <li><label class="mr20"><input name="brands[]" type="checkbox" value="<{$v.brand_id}>" /><font class="c666 ml5"><{$v.brand_name}></font></label></li>
                <{/foreach}>
                </ul>
              </div>
            </td>
          </tr>
          <tr>
            <th>Meta 关键词</th>
            <td><textarea name="meta_keywords" id="meta_keywords" class="txtarea" cols="68" rows="5"></textarea></td>
          </tr>
          <tr>
            <th>Meta 描述</th>
            <td><textarea name="meta_description" id="meta_description" class="txtarea" cols="68" rows="5"></textarea></td>
          </tr>
          <tr>
            <th>排序</th>
            <td><input title="排序" value="99" class="w50 txt" name="seq" id="seq" type="text" /></td>
          </tr>
        </table>
      </div>
      <div class="submitbtn">
        <button type="button" class="ubtn btn" onclick="submitForm()">保存并提交</button>
        <button type="reset" class="fbtn btn">重置表单</button>
      </div>
    </div>
  </form>
</div>
<{else}>
<div class="content">
  <div class="loc"><h2><i class="icon"></i>编辑商品分类:<font class="ml5">[<{$rs.cate_id}>]</font></h2></div>
  <form method="post" action="<{url m=$MOD c='goods_cate' a='edit' id=$rs.cate_id step='submit'}>">
    <div class="box">
      <div class="module">
        <table class="dataform">
          <tr>
            <th width="110">分类名称</th>
            <td><input title="分类名称" class="w200 txt" name="cate_name" id="cate_name" type="text" value="<{$rs.cate_name}>" /></td>
          </tr>
          <tr>
            <th>上级分类</th>
            <td>
              <select id="parent_id" name="parent_id" class="slt">
                <option value="0">-- 无上级分类 --</option>
                <{foreach $parent_select as $v}>
                <{if $v.cate_id != $rs.cate_id}>
                <{if $v.cate_id == $rs.parent_id}>
                <option value="<{$v.cate_id}>" selected="selected"><{str_repeat('|—', $v.lv)}><{$v.cate_name}></option>
                <{else}>
                <option value="<{$v.cate_id}>"><{str_repeat('|— ', $v.lv)}> <{$v.cate_name}></option>
                <{/if}>
                <{/if}>
                <{/foreach}>
              </select>
            </td>
          </tr>
          <tr>
            <th>分类下品牌</th>
            <td>
              <div class="ckrow pad5">
                <ul class="c666">
                <{foreach $brand_select as $v}>
                <li><label class="mr20"><input name="brands[]" type="checkbox" value="<{$v.brand_id}>" <{$v.checked}> /><font class="c666 ml5"><{$v.brand_name}></font></label></li>
                <{/foreach}>
                </ul>
              </div>
            </td>
          </tr>
          <tr>
            <th>Meta 关键词</th>
            <td><textarea name="meta_keywords" id="meta_keywords" class="txtarea" cols="68" rows="5"><{$rs.meta_keywords}></textarea></td>
          </tr>
          <tr>
            <th>Meta 描述</th>
            <td><textarea name="meta_description" id="meta_description" class="txtarea" cols="68" rows="5"><{$rs.meta_description}></textarea></td>
          </tr>
          <tr>
            <th>排序</th>
            <td><input title="排序" class="w50 txt" name="seq" id="seq" value="<{$rs.seq}>" type="text" /></td>
          </tr>
        </table>
      </div>
      <div class="submitbtn">
        <button type="button" class="ubtn btn" onclick="submitForm()">保存并更新</button>
        <button type="reset" class="fbtn btn">重置表单</button>
      </div>
    </div>
  </form>
</div>
<{/if}>
</body>
</html>
